﻿using HarmonyLib;
using RimWorld;
using RimWorld.Planet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using Verse.AI;
using MVCF;
using MVCF.Utilities;
using Verse.Sound;

namespace Miao.Stand
{
    public class KillerQueenStand : StandPawn
    {
        public Thing bombTarget;
        public override bool IsMeleeStand => true;
        public Pawn SheeHeartAttack//总感觉会造成一定的gc问题。
        {
            get
            {
                if(sheeHeartAttack==null)
                {
                    return null;
                }
                if(sheeHeartAttack.Spawned)
                {

                    return sheeHeartAttack;
                }
                return null;
               
            }
            set
            {
                sheeHeartAttack = value;
            }
        }
        private Pawn sheeHeartAttack;


        public float killQueenExplosionRadius;

        //public float firstBombCost=1f;
        //public float secondBombCost=1f;


        public override void InitStandAbility()
        {
            base.InitStandAbility();
            standAbilityTracker.standAbilities.Add(StandAbilityMaker.CreateStandAbility("FristBomb", this));
            standAbilityTracker.standAbilities.Add(StandAbilityMaker.CreateStandAbility("SecondBomb", this));
        }

        public override void SetupField(StandExtension standExtension)
        {
            base.SetupField(standExtension);
            killQueenExplosionRadius = standExtension.killQueenExplosionRadius;
        }
        public override void LevelSpeedChange()
        {
            base.LevelSpeedChange();
            if (SheeHeartAttack != null)//如果释放了枯萎穿心攻击,则处于降低状态
            {
                LevelSpeed = -1;
            }
        }


        public override void ExposeData()
        {
            base.ExposeData();
            Scribe_References.Look<Thing>(ref bombTarget, "bombTarget");
            Scribe_References.Look<Pawn>(ref sheeHeartAttack, "sheeHeartAttack");
        }
    }
}
